Fix display of keys in 'help-form' buffers (bug#77118)
authorStephen Berman <stephen.berman@gmx.net>
Sat, 12 Apr 2025 10:01:50 +0000 (12:01 +0200)
committerStephen Berman <stephen.berman@gmx.net>
Sat, 12 Apr 2025 10:01:50 +0000 (12:01 +0200)
* lisp/help.el (help-form-show): Use 'insert' instead of 'princ'
so that keys in 'help-form' are displayed with 'help-key-binding' face.

lisp/help.el

index 1d87c2209c8cf8c0c7da389afd4626a964d90c49..a06679b31f5d462cddae02f936105bc8a8942ca5 100644 (file)
@@ -2262,8 +2262,13 @@ The `temp-buffer-window-setup-hook' hook is called."
   "Display the output of a non-nil `help-form'."
   (let ((msg (eval help-form t)))
     (if (stringp msg)
-       (with-output-to-temp-buffer " *Char Help*"
-         (princ msg)))))
+       (let ((bufname " *Char Help*"))
+          (with-output-to-temp-buffer bufname)
+          ;; Use `insert' instead of `princ' so that keys in `help-form'
+          ;; are displayed with `help-key-binding' face (bug#77118).
+          (with-current-buffer bufname
+            (let (buffer-read-only)
+              (insert msg)))))))
 
 (defun help--append-keystrokes-help (str)
   (let* ((keys (this-single-command-keys))